/**
 * Copyright &copy; 2019-2022 <a href="https://gitee.com/rit/zx-pm">zx-pm</a> All rights reserved.
 */
package com.zx.pm.modules.zx.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zx.pm.common.service.TreeService;
import com.zx.pm.modules.zx.dao.KeywordDao;
import com.zx.pm.modules.zx.entity.Keyword;

/**
 * 采购目录Service
 * @author forest
 * @version 2019-01-04
 */
@Service
@Transactional(readOnly = true)
public class KeywordService extends TreeService<KeywordDao, Keyword> {

	public List<Keyword> findList(){
		return dao.findList(new Keyword());
	}
	
	@Transactional(readOnly = true)
	public List<Keyword> findList(Keyword keyword){
		if(keyword != null){
			keyword.setParentIds(keyword.getParentIds() + "%");
			return dao.findByParentIdsLike(keyword);
		}
		return  new ArrayList<Keyword>();
	}
	
	@Transactional(readOnly = false)
	public void save(Keyword Keyword) {
		super.save(Keyword);
	}
	
	@Transactional(readOnly = false)
	public void delete(Keyword keyword) {
		super.delete(keyword);
	}
	
}
